#ifndef KEYDIALOG_H
#define KEYDIALOG_H

#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QKeyEvent>

#include "button.h"
#include "keycontrollablemenu.h"

class KeyDialog : public KeyControllableMenu
{
    Q_OBJECT
public:
    KeyDialog(QWidget * parent=0);
    bool isOneKey();
    void setOneKey(bool value);
    QString getText();
    int getModifiers();
    void setLabel(QString label);
    void setKey(int key, int modifiers);
    void show();
    void keyPressEvent ( QKeyEvent * event );
    void closeEvent(QCloseEvent *event);
    void clearText();
    Button *  getOkButton();
    Button *  getCancelButton();
signals:
    void okSelected(KeyDialog *);
    void cancelSelected();

public slots:
    void buttonSelected();

private:
    QLabel * input;  //
    QLabel * label;
    Button * okButton;
    Button * cancelButton;
    bool oneKey;        //true if used to grab a key input
    int modifiers;      //holds the modifiers if a one key modifier
};

#endif // KEYDIALOG_H
